import React, { Component } from 'react'
import PubSub from 'pubsub-js';
class Item extends Component {
    constructor(props) {
        super(props);
    }
    state = {
        count: 20
    }
    giveCount = () => {
        // pubsub库的发布消息
        PubSub.publish('give', this.state.count);
    }
    render() {
        return (
            <div>
                <h1>item</h1>
                <button onClick={this.giveCount}>发布20俯卧撑</button>
            </div>
        );
    }
}

export default Item;